public class ClassLoaderTest {
    public static void main(String[] args) {
        // 获取系统加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);

        // 获取系统加载器的父类，注意：不同的 JDK 的类加载器是不同的,
        ClassLoader parent = systemClassLoader.getParent();
        System.out.println(parent);

        ClassLoader parentParent = parent.getParent();
        System.out.println(parentParent);

        try {
            // 查看由哪个加载器进行加载
            Class<?> test = Class.forName("ClassLoaderTest");
            ClassLoader classLoader = test.getClassLoader();
            System.out.println(classLoader);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }
}
